// 这里用来封装接口函数

import ajax from "./ajax";
import mockajax from "./mockajax";
import request from "./fetch";
const user = "/user";

/******************* 张家琦 ******************** */

// 获取歌手分类
export function getSingerType(params) {
  return request({
    method: "GET",
    data: params,
    url: user + "/singer/class&json=true",
  }).then((res) => res.data);
}
export function getSongList(classid) {
  return request({
    method: "get",
    url: user + `/singer/list/${classid}?json=true`,
  });
}

/**********************kuangpinglan********************************* */
// 获取全部新碟的接口函数
export const reqAlbumApi = (area, limit) =>
  ajax({ url: `/album/new/${area}/${limit}`, method: "get" });

// 获取单个专辑详情接口
export const reqAlbumItemApi = (id) => {
  return ajax({ url: `/album?id=${id}`, method: "get" });
};

/********************* xiaobai ********************** */

// 获取推荐内容的
export const reqRecommendedContent = () => {
  return ajax({ url: `/personalized/newsong?limit=33`, method: "get" });
};

// 获取歌手列表的
export const reqSingerList = () => {
  return ajax({ url: `/top/artists?offset=0&limit=15`, method: "get" });
};

// 获取听书精选的数据
export const reqListeningBooks = () => {
  return ajax({ url: `/personalized?limit=45`, method: "get" });
};

// 获取不同国家的数据
export const reqNewSongsList = (area) => {
  return ajax({
    url: `/album/list/style?area=${area}&limit=30`,
    method: "get",
  });
};

// 获取榜单数据
export const reqRankingList = () => {
  return request({
    method: "GET",
    url: user + "/rank/list&json=true",
  }).then((res) => res.data);
};

// 请求获取验证码的
export const reqCode = (phone) => {
  return ajax({
    url: `/captcha/sent?phone=${phone}`,
    method: "get",
  });
};

// 校验验证码
export const reqVerifyCode = ({ phone, captcha }) => {
  return ajax({
    url: `/captcha/verify?phone=${phone}&captcha=${captcha}`,
    method: "get",
  });
};

// 请求登录
export const reqLogin = ({ phone, captcha }) => {
  return ajax({
    url: `/login/cellphone?phone=${phone}&captcha=${captcha}`,
    method: "get",
  });
};

// 获取用户信息
export const reqUserInfo = () => {
  return ajax({
    url: `/user/passport/auth/getUserInfo`,
    method: "get",
  });
};

// 退出登录
export const reqLogout = () => {
  return ajax({
    url: `/user/passport/logout`,
    method: "get",
  });
};

/********************* caiqian ********************** */
// 获取歌单分类列表
export const reqSongSheetList = () => {
  return ajax({
    url: `/playlist/catlist`,
    method: "get",
  });
};

// 获取歌单
export const reqSongSheet = (limit, tag) => {
  return ajax({
    url: `/top/playlist/limit=${limit}&cat=${tag}`,
  });
};
/*************************daishu**************************** */
// 获取最新mv
export const reqNewMv = () => {
  return ajax({
    url: `/mv/first?limit=20`,
    method: "get",
  });
};
// 获取所有mv：内地、日韩、欧美
export const reqAllMv = (area) => {
  console.log(area);
  return ajax({
    url: `/mv/all?area=${area}`,
    method: "get",
  });
};
/**************************leiwei*************************/
// 榜单
export function getRankList() {
  return request({
    method: "GET",
    url: user + "/rank/list&json=true",
  }).then((res) => res.data);
}
